#include <iostream>

using namespace std;

struct LNode{
	LNode* next;
};

typedef LNode* List;

LNode* find(List listA, List listB){
	LNode *la = listA, *lb = listB;
	
	if(NULL == la || NULL == lb)
		return NULL;

	if(la == lb)
		return la;
	int lenA = 1, lenB = 1;
	while(la->next){
		++lenA;
		la = la->next;
	}
	while(lb->next){
		++lenB;
		lb = lb->next;
	}
	
	la = listA;
	lb = listB;

	int diff = lenA - lenB;
	while(diff > 0){
		la = la->next;
		--diff;
	}

	while(diff < 0){
		lb = lb->next;
		++diff;
	}

	while(la != lb)
	{
		la = la->next;
		lb = lb->next;

		if(NULL == la)
			break;
	}

	if(NULL == la)
		return NULL;

	return la;
}